import serial


with serial.Serial("com10", baudrate=115200) as ser:
    ser.flush()
    with open("hall.csv", "w") as f:
        while True:
            data = ser.readline()
            # print(data)
            data = data.strip().decode('utf-8')
            f.write(data + '\n')
     
